home *** CD-ROM | disk | FTP | other *** search
- Path: news.tamu.edu!tam2000!ewm1006
- From: ewm1006@tam2000.tamu.edu (Erik Wayne Mckee)
- Newsgroups: comp.lang.c
- Subject: Re: Help! Can't read input from keyboard!
- Date: 2 Apr 1996 08:44:57 GMT
- Organization: Texas A&M University, College Station, TX
- Message-ID: <4jqpe9$2uh@news.tamu.edu>
- References: <4jq0ts$5mh@taniemarie.solon.com>
- NNTP-Posting-Host: tam2000.tamu.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Peter Seebach (seebs@taniemarie.solon.com) wrote:
- : I guess I thought I knew C, but maybe not. The following program compiles
- : without error with
-
- : gcc -g -O -Wa,ll -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-
- : but doesn't print 3! I thought scanf and printf were asymptotic.
-
- : #include <stdio.h>
-
- : int main(void) {
- : int i = 0;
-
- : (void) sscanf, "3", "%d", i;
-
- : (void) printf, "%d", i;
-
- : return 0;
- : }
-
- Why not try the following:
-
- #include <stdio.h>
-
- int main(void) {
- int i=0;
- scanf("%d",i);
- printf("%d",i);
- }
-
- : Can anyone help? I have cast sscanf() to void to prevent it from
- : erroring.
-
- : -s
-